VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form frmRecuperar 
   BackColor       =   &H00800000&
   Caption         =   "RESPALDOS Y SEGURIDAD"
   ClientHeight    =   8520
   ClientLeft      =   3360
   ClientTop       =   3465
   ClientWidth     =   10950
   Icon            =   "frmrecuperar.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   8520
   ScaleWidth      =   10950
   StartUpPosition =   2  'CenterScreen
   WindowState     =   2  'Maximized
   Begin VB.Timer Timer1 
      Interval        =   1000
      Left            =   10440
      Top             =   2520
   End
   Begin MSComDlg.CommonDialog c 
      Left            =   3240
      Top             =   2280
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
      Filter          =   " ACCESS | *.mdb"
   End
   Begin VB.CommandButton Command5 
      Caption         =   "Recuperar  PenDrive"
      BeginProperty Font 
         Name            =   "Eras Bold ITC"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   400
      Left            =   7560
      TabIndex        =   6
      Top             =   3720
      Width           =   2800
   End
   Begin VB.CommandButton Command4 
      Caption         =   "Respadar PenDrive"
      BeginProperty Font 
         Name            =   "Eras Bold ITC"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   400
      Left            =   7560
      TabIndex        =   5
      Top             =   3120
      Width           =   2800
   End
   Begin VB.CommandButton Command3 
      Caption         =   "Salir"
      BeginProperty Font 
         Name            =   "Eras Bold ITC"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   400
      Left            =   7560
      TabIndex        =   4
      Top             =   4560
      Width           =   2800
   End
   Begin VB.FileListBox File1 
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   13.5
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   7290
      Hidden          =   -1  'True
      Left            =   360
      System          =   -1  'True
      TabIndex        =   3
      Top             =   840
      Width           =   6375
   End
   Begin VB.CommandButton Command2 
      Caption         =   "Recuperar Local"
      BeginProperty Font 
         Name            =   "Eras Bold ITC"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   400
      Left            =   7560
      TabIndex        =   2
      Top             =   1920
      Width           =   2800
   End
   Begin VB.CommandButton Command1 
      Caption         =   "Respaldar Local"
      BeginProperty Font 
         Name            =   "Eras Bold ITC"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   400
      Left            =   7560
      TabIndex        =   1
      Top             =   1320
      Width           =   2800
   End
   Begin VB.Label label2 
      Height          =   975
      Left            =   840
      TabIndex        =   7
      Top             =   960
      Visible         =   0   'False
      Width           =   3015
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "Respaldos Local"
      ForeColor       =   &H0080FFFF&
      Height          =   255
      Left            =   240
      TabIndex        =   0
      Top             =   720
      Width           =   1215
   End
End
Attribute VB_Name = "frmRecuperar"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
    Dim fso As New FileSystemObject

Sub Crear()
    Dim fso As New FileSystemObject
    If Not fso.FolderExists(RutaRespaldo & "respdacli4") Then
        fso.CreateFolder (RutaRespaldo & "respdacli4")
        fso.CreateFolder (RutaRespaldo & "respdacli4\REVISION")
    End If
End Sub

Private Sub Command1_Click()
On Error Resume Next
Dim t As DAO.Recordset
 Set t = Base.OpenRecordset("select max(cod_pedido) from PEDIDO")
      
  If Not IsNumeric(t(0)) Then
    nu = 1
  Else
    nu = t(0)
  End If
  
 Set t = Base.OpenRecordset("select max(fac) from factura")
      
  If Not IsNumeric(t(0)) Then
    nuf = 1
  Else
    nuf = t(0)
  End If
    
    nom = "Ped" & nu & "-Fac" & nuf & "_" + Format(Date, "dd-mm-yyyy") + "_" + Format(Time, "hh_mm") + ".mdb"
    fso.CopyFile RutaRespaldo & "DACLI.MDB", RutaRespaldo & "respdacli4\" & nom, True
    File1.Refresh
End Sub

Private Sub Command2_Click()
On Error Resume Next
    nom = "DACLI" + "--" + Format(Date, "dd'mm'yyyy") + "--" + Format(Time, "hhmm") + ".mdb"
    fso.CopyFile "C:\DACLI4\DACLI.MDB", "C:\respdacli4\REVISION\" + nom, True
    nom = File1.list(File1.ListIndex)
    fso.CopyFile RutaRespaldo & "respdacli4\" + nom, RutaRespaldo & "DACLI.MDB", True
    File1.Refresh
    End
End Sub

Private Sub Command3_Click()
    Unload Me
End Sub

Private Sub Command4_Click()
On Error Resume Next
    
 Set t = Base.OpenRecordset("select max(cod_pedido) from PEDIDO")
      
  If Not IsNumeric(t(0)) Then
    nu = 1
  Else
    nu = t(0)
  End If
  
 Set t = Base.OpenRecordset("select max(fac) from factura")
      
  If Not IsNumeric(t(0)) Then
    nuf = 1
  Else
    nuf = t(0)
  End If
    
    
    
    nom = "Ped" & nu & "-Fac" & nuf & "_" + Format(Date, "dd-mm-yyyy") + "_" + Format(Time, "hh_mm") + ".mdb"
    
    c.FileTitle = nom
    c.FileName = nom
    
    c.ShowSave
    a = c.FileName
    Label2.Caption = "Espere..."
    Label2.Visible = True
    Me.Enabled = False
    DoEvents
    fso.CopyFile RutaRespaldo & "DACLI.MDB", a, True
    Me.Enabled = True
    Label2.Visible = False
    
        File1.Refresh
    
End Sub

Private Sub Command5_Click()
On Error Resume Next
 Set t = Base.OpenRecordset("select max(cod_pedido) from PEDIDO")
      
  If Not IsNumeric(t(0)) Then
    nu = 1
  Else
    nu = t(0)
  End If
  
 Set t = Base.OpenRecordset("select max(fac) from factura")
      
  If Not IsNumeric(t(0)) Then
    nuf = 1
  Else
    nuf = t(0)
  End If
    
    
    
    
    nom = "Ped" & nu & "-Fac" & nuf & "_" + Format(Date, "dd-mm-yyyy") + "_" + Format(Time, "hh_mm") + ".mdb"
    
    c.FileName = nom
    c.ShowOpen
    a = c.FileName
    
    
    Base.Close
    fso.CopyFile a, RutaRespaldo & "\DACLI.MDB", True
    MainModule.Conectar_Base
    
    fso.CopyFile RutaRespaldo & "DATASDELCONRESPD.mdb", RutaRespaldo & "DATASDELCON.MDB", True
    File1.Refresh
    End
End Sub

Private Sub Command6_Click()
End Sub

Private Sub Form_Load()
On Error Resume Next
    Crear
    
    File1.Path = RutaRespaldo & "respdacli4"
    
    File1.Path = RutaRespaldo & "respdacli4"
    File1.Refresh
    
End Sub

'Private Sub Timer1_Timer()
 'a = Time
 'MsgBox a
 'aqui hay que poner las horas
 'If a = "09:00:00 a.m." Then Command1_Click
 'If a = "12:00:00 a.m." Then Command1_Click
 'If a = "04:00:00 p.m." Then
  '  Command1_Click
'End If
 'If a = "06:00:00 p.m." Then Command1_Click
    
 'End Sub
